<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function changeImg() {
            var imgObj=document.getElementById("codeImg");
            imgObj.src="checkCode?"+Math.random();
        }
    </script>
</head>
<body>
<form action="login">
  用户名：<input type="text" name="userName"><br>
  密码：<input type="text" name="pwd"><br>
    <img src="/checkCode" id="codeImg">
    <a href="javascript:changeImg()">看不清楚，换一张</a><br>
    请输入验证码：<input type="text" name="code" id="code">
    <input type="submit" value="登录">
</form>
</body>
</html>